package com.uraurora.crescent.tuple;


/**
 *  * 元组接口定义
 * @author ：Sei
 */
public interface ITuple extends Iterable<Object>{

    Object get(int index);

    <T> T get(int index, Class<T> type);

    Class<?> getType(int index);

    Class<?>[] getTypes();

    int size();

    <E> boolean contains(E element);

    Object[] toArray();

    default ITuple reverse(){
        Object[] os = toArray(), res = new Object[os.length];
        int size = os.length;
        for (int i = 0; i < size; i++) {
            res[i] = os[size-1-i];
        }
        return Tuple.of(res);
    }

}
